﻿//删除好友
function userFriendsDelete(FriendsUser) {
   var dialog= $.dboxDialog({
        title: '',
        content: '删除该好友,并且把我从Ta的好友中删除!',
        cancel: true,
        cancelText: '取 消',
        okText: '确 认',
        ok: function () {
            $.ajax({
                type: 'post',
                url: '/user/ajaxforfriends',
                data: "t=FriendsDelete&FriendsUser=" + FriendsUser,
                success: function (result) {
                    if (result != "" && result != "competence") {
                        AloneTips(result);
                        //移除该记录
                        $("#friends" + FriendsUser).remove();

                    }
                    else {
                        AloneTips("您所在的组没有进行此操作的权限");
                    }
                    dialog.close();
                }
            });
        },
        follow: $("#del_" + FriendsUser)
   });
   
}
//审核好友
function userFriendsAdd(LaunchID) {
    $.ajax({
        type: 'post',
        url: '/user/ajaxforfriends',
        data: "t=FriendsAdd&LaunchID=" + LaunchID,
        success: function (result) {
            if (result != "" && result != "competence") {
                AloneTips(result);
                //移除该记录
                $("#status_" + LaunchID).text("已通过");
                $("#status_" + LaunchID).attr("onclick", "");
            }
            else {
                AloneTips("您所在的组没有进行此操作的权限");
            }
        }
    });
}
//删除好友申请记录
function userFriendsLaunchDelete(LaunchID) {
   var dialog= $.dboxDialog({
        title: '',
        content: '确认删除该记录吗?',
        cancel: true,
        cancelText: '取 消',
        okText:'确 认',
        ok: function () {
            $.ajax({
                type: 'post',
                url: '/user/ajaxforfriends',
                data: "t=FriendsLaunchDelete&LaunchID=" + LaunchID,
                success: function (result) {
                    if (result != ""&&result!="competence") {
                        AloneTips(result);
                        //移除该记录
                        $("#friends" + LaunchID).remove();
                    }
                    else {
                        AloneTips("您所在的组没有进行此操作的权限");
                    }
                    dialog.close();
                }
            });
        },
        follow: $("#del_" + LaunchID)
    });
}
//申请好友
function userFriendsLaunchAdd(UserID) {
    $.ajax({
        type: 'post',
        url: '/user/ajaxforfriends',
        data: 't=FriendsLaunchAdd&TargetUser=' + UserID,
        success: function (result) {
            if (result != "" && result != "competence") {
                FollowTips(result, "friends_" + UserID);
            }
            else {
                FollowTips("您所在的组没有进行此操作的权限", "friends_" + UserID);
            }
        }
    });
}